-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add logging to explain reasons for Comet not being able to run a query stage natively #397
Conversation
@parthchandra How does this look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just some observations.
@@ -276,6 +276,14 @@ object CometConf { | |||
.booleanConf | |||
.createWithDefault(false) | |||
|
|||
val COMET_EXPLAIN_FALLBACK_ENABLED: ConfigEntry[Boolean] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need to make this configurable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a config should be good. Sometimes it might be verbose.
@@ -734,6 +734,22 @@ class CometSparkSessionExtensions | |||
} else { | |||
var newPlan = transform(plan) | |||
|
|||
// if the plan cannot be run natively then explain why (when appropriate config is enabled) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that ExecRule is going to be invoked multiple times as planning proceeds, this may get logged multiple times for the same plan. Perhaps that is why we need to keep this configurable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is one reason, yes. The logging could get verbose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would assume that this feature is useful in development but less so in production since we have the integration with Spark's explain for that.
@@ -734,6 +734,22 @@ class CometSparkSessionExtensions | |||
} else { | |||
var newPlan = transform(plan) | |||
|
|||
// if the plan cannot be run natively then explain why (when appropriate config is enabled) | |||
if (CometConf.COMET_EXPLAIN_FALLBACK_ENABLED.get() && !isCometNative(newPlan)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comet could only trigger native execution for partial query plan. This check isCometNative(newPlan)
only applies for the top operator.
I am moving this to draft for now while I test with TPC-H queries and make some improvements |
…-datafusion-comet into explain-fallback-reasons
@viirya @parthchandra This PR is ready for another review. I simplified the logic and removed the check to see if the top level operator is native or not. Instead, if we have recorded any info using |
// if the plan cannot be run fully natively then explain why (when appropriate | ||
// config is enabled) | ||
if (CometConf.COMET_EXPLAIN_FALLBACK_ENABLED.get()) { | ||
new ExtendedExplainInfo().extensionInfo(newPlan) match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated, but I feel ExtendedExplainInfo
can be object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I had the same thought
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible that it has to be a class due to the way this integrates into Spark, but I am not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just seeing this. I don't think Spark prevents us from this being an object. I'll take care of this. #452
@@ -45,7 +45,7 @@ class ExtendedExplainInfo extends ExtendedExplainGenerator { | |||
} | |||
} | |||
|
|||
private def extensionInfo(node: TreeNode[_]): Set[String] = { | |||
def extensionInfo(node: TreeNode[_]): Set[String] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps private[comet]
instead of public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I made that change.
@viirya I have 2 approvals but need a committer approval to be able to merge. |
Looks good to me. Thanks @andygrove |
…a query stage natively (apache#397) (cherry picked from commit 3808306)
Which issue does this PR close?
Closes #385
Rationale for this change
As a user, I would like to understand why my query stages are not running natively.
What changes are included in this PR?
New config + logging
How are these changes tested?
Tested manually: